import imp
import re
from app.models import Users
from app.statusenum import *


def isValidEmail(email):
    regex = re.compile(r'([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')
    if re.fullmatch(regex, email):
        return True
    else:
        return False


def isValidUser(user: Users):
    if user.user_status == UserStatusEnum.NORMAL:
        return True
    else:
        return False
